package com.yootk;
import java.util.concurrent.CountDownLatch;
public class YootkDemo08 {
    public static void main(String[] args) throws Exception {
        CountDownLatch countDownLatch = new CountDownLatch(2);
        for (int x = 0; x < 2; x++){
            new Thread(() -> {
                System.out.println("【" + Thread.currentThread().getName() + "】到达并上车" );
                countDownLatch.countDown();
            }, "客人-"+ x).start();
        }
        countDownLatch.await();
        System.out.println("【主线程】出发");
    }
}
